#
# Sample simulation
#
from simulation import Simulation
from boid import Boid
from mindset import BasicFlockingMindset
import PyCarrara
from PyCarrara import *
from random import uniform
from Container import BoxContainer



class SampleSimulation(Simulation):
  def init(self):
    self.scene.fps = 10.0
    self.end_time = 40.0
    self.scene.add_camera(name="Conical",focus_name="CameraFocus")
    self.add_boids()
    self.scene.container = BoxContainer(position=Vector(-100.0,-100.0,0.0),size=Vector(200.0,200.0,100.0))
    
  def add_boids(self):   
    for i in range(20) :
      b = Boid(name="boid" + str(i+1),mindset=BasicFlockingMindset(self.scene,sociable=uniform(0.0,1.0),prudent=uniform(0.0,1.0)),max_turn=360.0 ,min_speed=3.0,max_speed=12.0)
      self.scene.add_boid(b)
      b.refresh()
      b.velocity = Vector(0.0,-5.0,0.0)
          
    print "Done"   
    
    
SampleSimulation()